local ouxiang = fk.CreateSkill {
  name = "cf_ouxiang",
  tags = { Skill.Limited },
}

Fk:loadTranslationTable {
  ["cf_ouxiang"] = "偶像",
  [":cf_ouxiang"] = "限定技，出牌阶段，你可以令所有吟唱选择过的其他角色交给你两张牌，然后重置吟唱本回合选择过的角色。",
  ["#cf_ouxiang"] = "令所有吟唱选择过的其他角色交给你两张牌并重置“吟唱”",
  ["#cf_ouxiang_choose"] = "选择两张牌交给 %dest ",
  ["$cf_ouxiang1"] = "哼哼哼~哼哼。",
  ["$cf_ouxiang2"] = "大家加油哦！",
}

ouxiang:addEffect("active", {
  anim_type = "big",
  can_use = function(self, player)
    return player:hasSkill(self.name) and player:usedSkillTimes(self.name, Player.HistoryGame) == 0
  end,
  prompt = "#" .. ouxiang.name,
  card_num = 0,
  target_num = 0,
  on_cost = function(self, player, data, extra_data)
    local room = player.room
    local to = table.filter(room:getOtherPlayers(player), function(element, index, array)
      return table.contains(player:getTableMark("cf_yinchang"), element.id)
    end)
    return { tos = to }
  end,
  on_use = function(self, room, skillUseEvent)
    local player = skillUseEvent.from
    local tos = skillUseEvent.tos
    for _, to in ipairs(tos) do
      local cards = room:askToCards(to, {
        min_num = 2,
        max_num = 2,
        target = to,
        flag = "he",
        skill_name = self.name,
        prompt = "#" .. self.name .. "_choose::" .. player.id,
        cancelable = false,
        include_equip = true,
      })
      room:obtainCard(player, cards, true, fk.ReasonJustMove, player, self.name)
      for _, p in pairs(player:getTableMark("cf_yinchang-phase")) do
        room:removeTableMark(player, "cf_yinchang-phase", p)
      end
    end
  end
})

return ouxiang
